Skip to content

feat(tracker): optional estimation sum in issue list group headers - #11122

Closed
MichaelUray wants to merge 2 commits into
hcengineering:developfrom
MichaelUray:feat/issue-group-estimation-sum
Closed

MichaelUray wants to merge 2 commits into
hcengineering:developfrom
MichaelUray:feat/issue-group-estimation-sum

Conversation

@MichaelUray

@MichaelUray MichaelUray commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7034

Problem and change

Issue list group headers only showed the reported/estimated time when the
list was grouped by milestone or assignee, so e.g. a Backlog status group gave
no idea how much work it holds.

Add a "Show estimation sum in groups" display option to the issue, milestone
and component list views (off by default). When enabled, IssueStatistics is
shown for every grouping. The list header now passes the projected documents
of the whole group and the view options to header extras. When the option is enabled and the group is only partially loaded, IssueStatistics fetches time fields for all issue IDs in the group and uses the response to supplement the live loaded rows. It adds no live subscription and does not repeat the query for updates to loaded rows or additional pages while the group ID set remains unchanged.

Without the option, milestone and assignee headers keep the previous
calculation unchanged (calcPlanningIssueTimeStats): the loaded rows, with
each loaded parent counting all its sub-issues through childInfo, including
sub-issues that are not loaded or are listed in another group.

With the option, the sum uses calcIssueTimeStats. Sub-issues with an
ancestor in the same group are counted through that ancestor's childInfo.
Only childInfo entries of sub-issues of the same group are used, so a
sub-issue listed in another group is counted there and not twice (all entries
are used when sub-issues are hidden). Behaviour change, only with the
option enabled:
time is counted in the group the issue is listed in. For
example, a sub-issue assigned to Bob under a parent assigned to Alice counts
for Bob, not for Alice. For closed root issues, estimation is capped by reported time when there are no relevant children, or by the children's reported time when their estimation sum is nonzero. If relevant children exist but their estimation sum is zero, the parent's estimation is retained without that cap. In milestone/assignee planning groups, unstarted root issues contribute reported time but no estimation.

Tests

  • New unit tests in plugins/tracker-resources/src/__tests__/issueTimeStats.test.ts:
    • with the option: a parent and its child in the same group are counted once, a child in another group is counted there, plus hidden sub-issues, grandchildren and closed issues;
    • without the option: the planning totals match the previous calculation, including sub-issues outside the loaded page.
  • Browser check (Chromium, Firefox, WebKit) with the option off, grouped by assignee: a parent (5h) assigned to one user with a sub-issue (3h) assigned to another. The parent's header shows 3h, counted through childInfo as before. The previous PR head showed 5h there.

Issue list group headers only showed the reported/estimated time when the
list was grouped by milestone or assignee, so e.g. a Backlog status group gave
no idea how much work it holds.

Add a "Show estimation sum in groups" display option to the issue, milestone
and component list views (off by default). When enabled, IssueStatistics is
shown for every grouping. The list header now passes the projected documents
of the whole group and the view options to header extras. With the option
enabled, IssueStatistics fetches the time fields of the not yet loaded group
issues once per set of group issue ids (no extra live subscriptions, no
refetch on live updates of loaded rows or when another page is loaded);
loaded rows stay live. Milestone/assignee summaries without the option keep
using the loaded rows as before.

The summing is extracted into the pure helper calcIssueTimeStats with unit
tests. Sub-issues with an ancestor in the same group are counted through that
ancestor's childInfo, and only childInfo entries of sub-issues of the same
group are used, so a sub-issue listed in another group is counted there and
not twice (all entries are used when sub-issues are hidden). Closed issues
are capped by reported time and unstarted issues are excluded only for
milestone/assignee planning groups, as before.

Fixes hcengineering#7034

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
@ArtyomSavchenko

Copy link
Copy Markdown
Contributor

Thanks @MichaelUray, please take a look at the following review comments:

  1. Totals drop when a group isn’t fully loaded. The new sum only counts sub-issues that are loaded in the same group. Milestone and assignee headers still use just the loaded rows, so once a group is longer than one page, sub-issues that aren’t loaded yet stop counting. Before this change they were counted through their parent’s list of children. So these totals can now come out lower than before, even with the new option off.
  2. The commit message says these totals work “as before”, but the numbers change even when fully loaded. Say a parent issue is assigned to Alice and its sub-issues to Bob. The sub-issue time used to show under Alice and now shows under Bob. That’s arguably more correct, but it should be described as a change.
  3. Suggested fix: keep the old full-children sum for milestone and assignee headers when the option is off. Or, when a group isn’t fully loaded, fetch the remaining issues for those headers too.

…e sum option

Without "Show estimation sum in groups", milestone and assignee group
headers again use the previous calculation: the loaded rows plus the full
childInfo of each loaded parent. Sub-issues that are not loaded yet keep
counting, so the totals are the same as before this feature.

With the option enabled, all issues of the group are fetched and each
issue's time is counted in the group the issue is listed in. A sub-issue
assigned to Bob under a parent assigned to Alice then counts for Bob, not
for Alice. This is a change from the previous behaviour, limited to the
opt-in option.

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
@MichaelUray

Copy link
Copy Markdown
Contributor Author

Thanks @ArtyomSavchenko, you are right on all three points. I added a follow-up commit.

1. and 3. Totals when a group is not fully loaded

I went with your first suggestion. Without the "Show estimation sum in groups" option, milestone and assignee headers use the previous calculation again: the loaded rows, with each loaded parent counting all of its sub-issues through childInfo, whether or not they are loaded. The totals are the same as before this PR, including for groups longer than one page. I checked it in Chromium, Firefox and WebKit: with a parent (5h) assigned to one person and its sub-issue (3h) assigned to another, the parent's assignee header shows 3h again; the previous commit showed 5h. I kept it as a separate helper, calcPlanningIssueTimeStats, so it can be tested against the old behaviour branch by branch: closed-issue cap, zero sub-issue estimation, backlog roots, nested sub-issues.

With the option enabled, the header fetches the time fields of the group's issues that are not loaded yet. It then sums the whole group, so nothing drops out when a group spans several pages.

2. Commit message

Agreed, "as before" was wrong for the enabled option. Without the option the numbers are now really unchanged. With the option, time is counted in the group the issue is listed in: a sub-issue assigned to Bob under a parent assigned to Alice counts for Bob, not for Alice. The new commit message describes this as a change, limited to the opt-in option, and I updated the PR description the same way.

@MichaelUray

Copy link
Copy Markdown
Contributor Author

This work continues in the Platform Collective repository: Platform-Collective/platform#285. Closing this pull request here to keep the discussion in one place. Thank you for the reviews and feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add sum of estimation time

2 participants